@extends('admin.mainlayout')
@section('title')
    <div class="title"><span>修改分类></span></div>
    @endsection
    @section('content')
        <!-- 基本信息 -->
    <div class="three">
        <div class="body">
            <!--基本信息-->
            <form action="{{urlAdmin('category','postEdit')}}" id="form" method="post">
            <div class="left">
                <div class="one">
                    <p>所属分类</p>
                    <select name="parentid">
                        <option value="0">顶级分类</option>
                        @foreach($rows as $v)
                            <option value="{{$v['id']}}"
                                    @if($data['parentid']==$v['id'])
                                        selected
                                    @endif
                            >{{$v['prefix']}}{{$v['name']}}</option>
                        @endforeach

                    </select>
                </div>
                <div class="one">
                    <p>分类名称</p>
                    <input type="text" name="name" value="{{$data['name']}}"/>
                </div>
                <div class="one" style="width: 450px;">
                    <p>分类排序</p>
                    <input type="text" name="sort" value="{{$data['sort']}}"/><span style="float: right;">(越小越靠前)</span>
                </div>
                <br/>
                <div class="three">
                    <p>是否显示</p>
                    是:<input type="radio" name="show" @if(isset($data['show'])&&$data['show']==1) checked @endif value="1"/>
                    否:<input type="radio" name="show" @if(isset($data['show'])&&$data['show']==0) checked @endif value="0"/>
                </div>
                <input type="hidden" name="id" value="{{$data['id']}}">
                <div class="save" id="tijiao">保存</div>
            </div>
            </form>
        </div>
    </div>
    <script>
        
        var message = "{{Session::get('message')}}";
        var status = "{{Session::get('status')}}";
        $(window).ready(function () {
            if (message) {
                layer.msg(message, {
                    time: 3000 //2秒关闭（如果不配置，默认是3秒）
                });

            }
            if(status){
                setTimeout('location.href="{{urlAdmin('Category','getIndex')}}"',1000);
            }
        });

        $('#tijiao').click(function(){


            $('#form').submit();

        });
        

        
    </script>
@endsection
